CREATE PROCEDURE dbo.AB_GetDocDueDateOne
AS
BEGIN

      declare @DocDueDate datetime
      set @DocDueDate = DATEADD(DAY,1,CONVERT(varchar(20),GETDATE(),106)) 
      
      create table TempTable  (tempDueDate datetime)
      declare @NoOfDayCount int 
      set  @NoOfDayCount = 1


      WHILE  @NoOfDayCount = 1
            BEGIN
                  WHILE DATENAME(WEEKDAY, @DocDueDate) IN ('Saturday','Sunday')
                        BEGIN
                              SET @DocDueDate = DATEADD(DAY,1,@DocDueDate)
                        END
                        
                  insert into TempTable (tempDueDate)
                  select @DocDueDate
                  
                  set @NoOfDayCount = @NoOfDayCount + 1
                  SET @DocDueDate = DATEADD(DAY,1,@DocDueDate)
            END   

      select * from TempTable

      drop table TempTable

END
GO
